<template>
  <button @click="f">按钮1</button>
  <button v-on:click="f">按钮2</button>
<h3>敲回车事件</h3>
  <input type="text" placeholder="请输入你的商品!" v-model="search"
    @keydown.enter="f">
</template>

<script setup>
  import {ref} from "vue";

  const search =ref('');
  const f = ()=>{
    console.log('我是f函数');
    alert('你想搜索的是'+search.value+'吗?');

  }
</script>

<style scoped>

</style>